package org.grow.fund.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: xwg
 * @CreateDate: 2023/9/25
 */

@Configuration
public class CommonConfig {
       @Bean
           public MybatisPlusInterceptor mybatisPlusInterceptor(){
               MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
               PaginationInnerInterceptor paginationInnerInterceptor
                       = new PaginationInnerInterceptor(DbType.MYSQL);
               mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor);
              mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
               return mybatisPlusInterceptor;
           }
}
